using System;
using UnityEngine;

namespace PKGames
{
	public class PluginNative
	{
		protected const string callbackObjectSuccessMethodName = "OnSuccess";

		protected const string callbackObjectErrorMethodName = "OnError";

		protected string CreateCallbackObject(string methodName, Action<string> successAction, Action<string> errorAction)
		{
			string text = methodName.FirstLetterToUpper() + "#" + GetHashCode().ToString("X4");
			GameObject gameObject = new GameObject();
			gameObject.name = text;
			gameObject.AddComponent<DontDestroyOnLoad>();
			PluginListener pluginListener = gameObject.AddComponent(typeof(PluginListener)) as PluginListener;
			pluginListener.Success = successAction;
			pluginListener.Error = errorAction;
			return text;
		}
	}
}
